home *** CD-ROM | disk | FTP | other *** search
/ Hottest 6 / Hottest 6 (1996)(PDSoft)[!].iso / software / fredfish / 1059.lha / Programs / MathPlot / Macros / Parameter.mapl < prev    next >
Text File  |  1994-12-15  |  2KB  |  80 lines

  1. /* Test of getintervall2 */
  2. options results
  3.  
  4.  
  5. /* Plots parametric graphs, i.e. */
  6. /* x = f(t)                      */
  7. /* y = g(t)                      */
  8. /* t in [0,pi]                   */
  9. /* Try f(t)=sqr(t)*sin(t),       */
  10. /*     g(t)=sqr(t)*cos(t),       */
  11. /*     t in [0:10*pi]            */
  12.  
  13. requeststring 'prompt "y = f(t)"'
  14. yft = result
  15. if RC = 5 then exit;
  16.  
  17. requeststring 'prompt "x = g(t)"'
  18. xgt = result
  19. if RC = 5 then exit;
  20.  
  21. requeststring 'prompt "Start t"'
  22. evalstring result
  23. t0 = result
  24. if RC = 5 then exit;
  25.  
  26. requeststring 'prompt "Stop t"'
  27. evalstring result
  28. t1 = result
  29. if RC = 5 then exit;
  30.  
  31.  
  32. requeststring 'prompt "dt = "'
  33. evalstring result
  34. dt = result
  35. if RC = 5 then exit;
  36.  
  37.  
  38. /* OK, MathPlot will clear the screen before every plot when there */
  39. /* was no REAL plot before. So we have to do some trick to get a   */
  40. /* real plot....                                                   */
  41. /* If you do not understand this: Try this script and then plot    */
  42. /* another function or the axis. Then delete the next lines, clear */
  43. /* screen and do it again. The first time, you will se both        */
  44. /* functions, the second time only the last function.              */
  45.  
  46. getfunc 0
  47. a = result
  48.  
  49. setfunc 0 10000
  50. plot 0 normal
  51.  
  52. setfunc 0 a
  53.  
  54. /* End of trick.... */
  55.  
  56.  
  57. /* And here is the routine.... */
  58.  
  59. evalstring yft "x=" t0
  60. y0 = result
  61.  
  62. evalstring xgt "x=" t0
  63. x0 = result
  64.  
  65. x = t0
  66.  
  67. do while x < t1 
  68.  setconst t x
  69.  evalstring yft
  70.  yy = result
  71.  
  72.  evalstring xgt "x=" x
  73.  xx = result
  74.  
  75.  line x0 y0 xx yy "pixel=off"
  76.  x0 = xx
  77.  y0 = yy
  78.  x = x + dt 
  79. end 
  80.